<template>
  <div>
    <h1> ajax 实现 </h1>
    <p>
      npm i axios
    </p>
    <button @click="getUsers">读取用户</button>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  name: 'App',
  methods:{
    getUsers(){
      axios.get('/api/json/users').then(
        response=>{
          console.log('成功',response.data)
        },
        error=>{
          console.log('失败',error.msg)
        }
      )
    }
  }
}
</script>
<style>
</style>
